Skip to content

feat(fit): berth fit NAME shows where a request would run and why - #323

Merged
T-Crypt merged 1 commit into
nextfrom
T-Crypt/berth-fit
Nov 13, 2026
Merged

T-Crypt merged 1 commit into
nextfrom
T-Crypt/berth-fit

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Why

Berth Next milestone 2. #322 put the gateway's choice in internal/fit. This PR lets people and agents ask the
same question from the CLI: if a request came in for this right now, where would it go, and what would the start
cost?

What changes

  • berth fit NAME [--explain] [--config] [--costs] [--socket] [--format].
    • NAME can be an [[engine]] name, a discovered engine, or a model in some engine's serves.
    • For a model, every engine that serves it is ranked in berth.toml order, which is the set the gateway's
      resolve ranks.
    • The output is the pick and its reason, with a start time and its source.
    • --explain, or any answer with more than one candidate, adds the ranked table.
  • Without berthd, every card reads as blocked ("berthd did not report the card"), with a note that berthd is
    unreachable.
  • The agent skill and docs/interfaces.md list the command.

berth simulate --add stays a later slice, because it needs Fit to pack sizes, not only rank paths.

Proof

  • TestFitAgainstADaemon runs a real in-process berthd with one free card (gpu0). Model m is served by a on
    gpu1, which berthd does not report, and by b on gpu0.
    • The pick is b, free, even though a comes first in berth.toml. a comes second, blocked, so Fit ranks by
      path before config order.
    • The test also checks the human output, the case without berthd, and an unknown name with the list of engines.
  • Live on aphotic during the training run:
    • berth fit comfyui prints comfyui: blocked, sft-4b-3 holds the card with start unknown.
    • berth fit router-strata --explain resolves the model to strata-sc117, which matches the gateway's pick.
  • proof.sh full passes.

berth fit ranks what it takes to bring an engine, or every engine that
serves a model, up right now: resume from RAM, a free card, a drain of the
holder, or blocked by a VM, a cordon or a pinned lease. Each candidate
names its reason, its weights' tier and the gateway's measured switch time
from that tier, or unknown. It reads the same fit.Rank the gateway picks
through, so its answer is the gateway's. --explain lists every candidate.
@T-Crypt
T-Crypt merged commit 098ef3c into next Nov 13, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/berth-fit branch November 13, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant